<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php $this->_ToolbarDefault();?>
<div id="janews-main">
<form action="index.php" method="post" name="adminForm">
<div id="editcell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="10">
				<?php echo JText::_( 'ID' ); ?>
			</th>
			<th width="10">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->frontpages ); ?>);" />
			</th>
			<th width="30%">
				<?php echo JHTML::_('grid.sort', JText::_("TITLE"), 's.title', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
			<th width="50">
			<?php echo JHTML::_('grid.sort', JText::_( 'DEFAULT' ), 'published', @$this->lists['order_Dir'], @$this->lists['order']); ?>
			</th>
			<th width="20%">
				<?php echo JHTML::_('grid.sort', JText::_('HEADLINE'), ' headline', @$this->lists['order_Dir'], @$this->lists['order'], $this->task ); ?>
			</th>
			<th width="20%">
				<?php echo JHTML::_('grid.sort', JText::_('BLOG'), ' blog', @$this->lists['order_Dir'], @$this->lists['order'], $this->task ); ?>
			</th>
			<th>
				<?php echo JText::_( 'SECTIONS' ); ?>
			</th>
		</tr>			
	</thead>
	
	<tbody>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->frontpages ); $i < $n; $i++)
	{
		$row = &$this->frontpages[$i];
		$checked 	= JHTML::_('grid.id',   $i, $row->id );
		$link 		= JRoute::_( 'index.php?option=com_janews&controller=frontpage&task=edit&cid[]='. $row->id );
		//$link_hln = JRoute::_('index.php?option=com_janews&controller=layouttemplates&task=edit&cid[]='.$row->headline);
		//$link_blg = JRoute::_('index.php?option=com_janews&controller=layouttemplates&task=edit&cid[]='.$row->blog);
		//$published 	= JHTML::_('grid.published', $row, $i );
		?>
		<tr class="<?php echo "row$k"; ?>">
			<td>
				<b><u><a href="<?php echo $link; ?>"><?php echo $row->id?></a></u></b>
			</td>
			<td>
				<?php echo $checked; ?>
			</td>
			<td>
				<a href="<?php echo $link; ?>"><?php echo $row->title; ?></a>
			</td>
			<td align="center">
			<?php if ($row->published) : ?>
			<img src="templates/khepri/images/menu/icon-16-default.png" alt="<?php echo JText::_( 'DEFAULT' ); ?>" />
			<?php else : ?>
				&nbsp;
			<?php endif; ?>
			</td>
			<?php $model = $this->getModel();?>
			<td>
				<?php echo $model->getTitleTempl($row->headline); ?>
			</td>
			<td>
				<?php echo $model->getTitleTempl($row->blog); ?>
			</td>
			<td>
				<?php echo $row->sections; ?>
			</td>
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
	</tbody>
	</table>
</div>

<input type="hidden" name="option" value="com_janews" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="frontpage" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>